/**
 * Created with IntelliJ IDEA.
 * User: weixintao
 * Date: 15-3-20
 * Time: 上午11:57
 * To change this template use File | Settings | File Templates.
 */
package Hxw3DEngine.asset.parsers.bson.vo {
import flash.utils.Dictionary;

public class ClassManager {

	private static var _instance:ClassManager;
	
    private var createFuncs:Dictionary = new Dictionary();
    private var prioritis:Dictionary = new Dictionary();

    public function ClassManager(){
        createFuncs["skeleton"] = Skeleton.create;
        createFuncs["skeleton_anim"] = SkeletonAnim.create;
        createFuncs["materials"] = MaterialBase.create;
        createFuncs["textures"] = TextureBase.create;
        createFuncs["meshes"] = MeshVO.create;
        createFuncs["glows"] = GlowVO.create;

        prioritis["skeleton"] = 0;
        prioritis["skeleton_anim"] = 1;
        prioritis["textures"] = 2;
        prioritis["materials"] = 3;
        prioritis["meshes"] = 4;
        prioritis["glows"] = 5;
    }
    public function getClassCreator(key:String):Function{
        if(key in createFuncs){
            return createFuncs[key] as Function;
        }
        return null;
    }
    public function getClassPriority(key:String):int{
        if(key in prioritis){
            return prioritis[key] as int;
        }
        return -1;
    }
    public static function get instance():ClassManager {
        return _instance?_instance:_instance=new ClassManager();
    }	
}
}
